package com.jml.controller;

import com.jml.bean.Stock;
import com.jml.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 * @Author yaxiongliu
 **/
@RestController
public class StockController {
    @Autowired
    private StockService stockService;

    @RequestMapping("/stock/add")
    public boolean addStockHandle(@RequestBody Stock stock) {
        stockService.addStock(stock);
        if(stock.getTotal()==-1){
            throw new RuntimeException("my error");
        }
        return true;
    }
}
